package com.kakaxi.mybilibili.view;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;

import com.kakaxi.mybilibili.utils.LogUtil;

/**
 * Created by kakaxi on 16/9/16.
 */

public class TestView extends View {


    public TestView(Context context) {
        super(context);
    }

    public TestView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public TestView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        super.onMeasure(widthMeasureSpec, heightMeasureSpec);
        LogUtil.d("父控件宽度:" + ((ViewGroup) getParent()).getMeasuredWidth());
        LogUtil.d("控件宽度:" + MeasureSpec.getSize(widthMeasureSpec));
    }
}
